﻿// -----------------------------------------------------------------------
// <copyright file="CustomButton.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Gui.ControlBuilders
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Xml;
    using Metal.Config;
    using Gui.ThemeEngine;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class CustomButton : BaseControl
    {
        /// <summary>
        /// Create the custom control
        /// </summary>
        /// <param name="controlProperties">The Xml node that contains the control properties</param>
        /// <returns>Returns custom control</returns>
        public Controls.MetalButton GetControl(XmlNode controlProperties)
        {
            string strThemeName = Settings.Instance.GetValue("LastSettings.Theme", "BlackMetal");

            Controls.MetalButton customButton = new Controls.MetalButton();

            this.BuildControl(controlProperties, customButton);

            customButton.BackgroundImage = System.Drawing.Image.FromFile(Paths.ThemesFolder + strThemeName + "\\" + PropertyProvider.GetValue(controlProperties, "image", "no-image.png"));
            customButton.DefaultImageName = Paths.ThemesFolder + strThemeName + "\\" + PropertyProvider.GetValue(controlProperties, "image", "no-image.png");
            customButton.MouseHoverImageName = Paths.ThemesFolder + strThemeName + "\\" + PropertyProvider.GetValue(controlProperties, "mouseEnter", "no-image.png");
            customButton.MouseDownImageName = Paths.ThemesFolder + strThemeName + "\\" + PropertyProvider.GetValue(controlProperties, "mouseDown", "no-image.png");
            customButton.Name = PropertyProvider.GetValue(controlProperties, "command", "button");

            return customButton;
        }

        /// <summary>
        /// Apply common properties
        /// </summary>
        /// <param name="control">The Xml node that contains our control properties</param>
        /// <param name="customControl">The custom control that will be created</param>
        public override void BuildControl(System.Xml.XmlNode control, System.Windows.Forms.Control customControl)
        {
            base.BuildControl(control, customControl);
        }
    }
}
